package com.woniuxy.microuserserver.service.impl;


import com.woniuxy.microcommonserver.bean.user_hpd.UserLevel;
import com.woniuxy.microuserserver.mapper.UserLevelMapper;
import com.woniuxy.microuserserver.service.IUserLevelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(readOnly = true)
public class UserLevelServiceImpl implements IUserLevelService {
    @Resource
    private UserLevelMapper userLevelMapper;

    @Override
    public List<UserLevel> findAllLevel() {
        return userLevelMapper.findAllLevel();
    }

    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    @Override
    public int addLevel(UserLevel userLevel) {
        return userLevelMapper.addLevel(userLevel);
    }

    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    @Override
    public int updateLevel(UserLevel userLevel) {
        return userLevelMapper.updateLevel(userLevel);
    }

    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    @Override
    public int deleteLevel(Long id) {
        return userLevelMapper.deleteLevel(id);
    }
}
